<?php
declare(strict_types=1);
namespace Field;

class QuestionCateCountConst
{
    public const pk='';
    public const index=['QuestionCateID'];
	public const fields=['QuestionCateID','Threads','Posts'];
	public const comment=['QuestionCateID'=>'分类ID','Threads'=>'帖子数量','Posts'=>'回帖数量包含帖子数量'];
	/*
    * @Field QuestionCateID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 分类ID
    */
    public const QuestionCateID = 'QuestionCateID';
    /*
    * @Field Threads
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 帖子数量
    */
    public const Threads = 'Threads';
    /*
    * @Field Posts
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 回帖数量包含帖子数量
    */
    public const Posts = 'Posts';
}

class QuestionCateCountColumns
{
public  int $QuestionCateID;
   public  int $Threads=0;
   public  int $Posts=0;
	public function toArray():array
	{
		return [
'QuestionCateID'=>$this->QuestionCateID,
    'Threads'=>$this->Threads,
    'Posts'=>$this->Posts,        ];
	}
}

class QuestionCateCountRow
{
	public QuestionCateCountColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'QuestionCateID' => $this->data->QuestionCateID,
        'Threads' => $this->data->Threads,
        'Posts' => $this->data->Posts, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new QuestionCateCountColumns();
        isset($data['QuestionCateID']) && $this->data->QuestionCateID = (int)$data['QuestionCateID'];
           isset($data['Threads']) && $this->data->Threads = (int)$data['Threads'];
           isset($data['Posts']) && $this->data->Posts = (int)$data['Posts'];
    }
}
?>